package com.learn.micro_mall.repository.convertor.brand;

import com.learn.micro_mall.dao.brand.model.Brand;
import com.learn.micro_mall.domain.entity.brand.BrandEntity;
import com.learn.micro_mall.service.request.brand.BrandCreateRequest;
import com.learn.micro_mall.service.request.brand.BrandDeleteRequest;
import com.learn.micro_mall.service.request.brand.BrandUpdateRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface BrandConvert {

    /**
     * 获取该类自动生成的实现类的实例
     * 接口中的属性都是 public static final 的 方法都是public abstract的
     */
    BrandConvert INSTANCES = Mappers.getMapper(BrandConvert.class);


    //    @Mappings({
//            @Mapping(source = "id", target = "userId"),
//            @Mapping(source = "username", target = "name"),
//            @Mapping(source = "role.roleName", target = "roleName")
//    })
    BrandEntity toBrandEntity(Brand brand);

    @Mappings({
            @Mapping(source = "brandId.brandName", target = "brandName")
    })
    Brand toBrand(BrandEntity brandEntity);
}
